<template>
	<view class="right-fix-main-box">
		<image @click="showAgreementHandler(3)" mode="widthFix" class="img" :src="baseImagePath + 'rule-icon.png'">
		</image>
		<image @click="telHandler" mode="widthFix" class="img" :src="baseImagePath + 'tel-icon.png'"></image>
		<image @click="gotoReceiveUrl()" mode="widthFix" class="img" :src="baseImagePath + 'quanyi-icon.png'"></image>
	</view>
	<agreement v-if="isShowAgreement" :agreementType="agreementType" @ok="agreementOkHandler"></agreement>
</template>

<script setup>
	import {
		ref
	} from "vue";
	import deviceUtil from "../../utils/deviceUtil";
	import messageUtil from "../../utils/messageUtil";

	const props = defineProps(['baseImagePath'])

	const isShowAgreement = ref(false)
	const agreementType = ref(1) // 1-订购须知,2-隐私政策

	const gotoReceiveUrl = () => {
		if (!deviceUtil.isWeChatBrowser()) {
			messageUtil.showFail('只能在微信里面打开')
			return;
		}
		window.location.href = 'https://web.78keji.cn/newlq/#/'
	}

	const showAgreementHandler = (value) => {
		isShowAgreement.value = true;
		agreementType.value = value;
	}

	const agreementOkHandler = () => {
		isShowAgreement.value = false;

	}

	const openUrl = (url) => {
		window.location.href = url
	}

	const gotoWxPlatform = () => {
		console.log('gotoWxPlatform')
		window.location.href =
			'https://mp.weixin.qq.com/mp/profile_ext?action=home&__biz=MzI2ODEzMjg1Mg==&scene=124#wechat_redirect'
	}
	const telHandler = () => {
		uni.makePhoneCall({
			phoneNumber: '4008825010'
		})
	}
</script>

<style lang="scss">
	.right-fix-main-box {
		position: fixed;
		right: 0;
		top: 150rpx;

		.img {
			width: 50rpx;
			height: auto;
			display: block;
			margin-bottom: 20rpx;
		}
	}
</style>